<?php

namespace App\Jobs;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\DB;

class QueueJobs implements ShouldQueue
{
    use Queueable;

    protected $msg;

    /**
     * Create a new job instance.
     */
    public function __construct($msg)
    {
        $this->msg = $msg;
    }

    /**
     * Execute the job.
     */
    public function handle()
    {
        //echo '接收到了消息：'. $this->msg . ',处理时间：',date('Y-m-d H:i:s'),PHP_EOL;
        // 将处理信息写入数据库 
        /*
        DB::connection()
        ->table('queue_test')
        ->insert([
            'user'=>'catchadmin',
            'msg' => $this->msg,
            'created_at' => now(),
        ]);
        */
    }
}
